<%@Page Language="VB"%>
<%@Import Namespace="System.Data" %>
<%@Import Namespace="System.Data.SqlClient" %>
<html><head>
<title>
The .NET DataSet and 
SqlDataAdapter Objects</title>
</head>
<body>
<span class="heading">The .NET DataSet 
and SqlDataAdapter Objects</span>
<hr width="350" align="left"/>
<div id="outError" runat="server">&nbsp;</div>
<asp:datagrid id="dgrResult" runat="server" />
<script language="vb" runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
   Dim strConn As String
   strConn= _
   ConfigurationSettings.appSettings("conn")
   
   Dim strSelect As String
   strSelect = "SELECT SubCateID,"
   strSelect +="SubCateName FROM "
   strSelect +=" tblSubCategories"
   strSelect +=" where SubCateID>10"
   Dim myDataSet As New DataSet()
   Try
      Dim myConn As New SqlConnection(strConn)
      Dim myDataAdapter As New _
	SqlDataAdapter(strSelect, myConn)
      myDataAdapter.Fill(myDataSet,  _
	"tblSubCategories")
   Catch objError As Exception
      	outError.innerHTML = _
	"<b>* Error while " & _
	"accessing data</b>.<br />" _
          	& objError.Message & "<br />" & _
	objError.Source
      Exit Sub  
   End Try
   Dim myDataView As New _
   DataView(myDataSet.Tables("tblSubCategories"))
   dgrResult.DataSource = myDataView
   dgrResult.DataBind()

End Sub
</script>
</body>
</html>
